package com.laf.manage.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

@Data
@ApiModel(value = "ContentDTO", description = "内容管理DTO")
public class ContentDTO {
    @ApiModelProperty("创建人id")
    private Long createUserId;

    @ApiModelProperty("动态状态")
    private Integer verifyStatus;

    @ApiModelProperty("查询关键字")
    private String keyword;

    @ApiModelProperty("标签id集合")
    private List<Long> tagIds;

    /** 请求参数 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params;

    public LocalDateTime getBeginTime()
    {
        if (params!= null && params.get("beginTime")!=null ){
            return LocalDateTime.parse(params.get("beginTime").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        }
        return null;
    }

    public LocalDateTime getEndTime()
    {
        if (params!= null && params.get("endTime")!=null ){
            return LocalDateTime.parse(params.get("endTime").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        }
        return null;
    }



}
